package com.yycx.module.bus.provider.service.impl;

import com.yycx.common.security.OpenHelper;
import com.yycx.module.bus.client.entity.BusCustomBank;
import com.yycx.module.bus.provider.mapper.BusCustomBankMapper;
import com.yycx.module.bus.provider.service.BusCustomBankService;
import com.yycx.common.mybatis.base.service.impl.BaseServiceImpl;
import com.yycx.common.mybatis.model.ResultBody;
import org.springframework.stereotype.Service;
import com.yycx.common.base.entity.EntityMap;
import com.yycx.common.mybatis.query.CriteriaQuery;
import org.springframework.transaction.annotation.Propagation;
import com.yycx.common.mybatis.query.CriteriaSave;
import org.springframework.transaction.annotation.Transactional;

/**
 * 客户银行账户接口实现类
 *
 * @author flyme
 * @date 2023-09-15
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BusCustomBankServiceImpl extends BaseServiceImpl<BusCustomBankMapper, BusCustomBank> implements BusCustomBankService {

    @Override
    public ResultBody beforeAdd(CriteriaSave cs, BusCustomBank bcb, EntityMap extra) {
        bcb.setCompanyId(OpenHelper.getCompanyId());
        return ResultBody.ok();
    }


    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public ResultBody beforePageList(CriteriaQuery<BusCustomBank> cq, BusCustomBank bcb, EntityMap requestMap) {
        Long customId = bcb.getCustomId();
        cq.eq(true, "customId", customId);
        cq.orderByDesc("customBank.createTime");
        return ResultBody.ok();
    }
}
